import pydoc
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode

from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base

from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker

from zope.sqlalchemy import ZopeTransactionExtension

from sqlalchemy import Text


from sqlalchemy import Table, Column, Integer, ForeignKey
from sqlalchemy.orm import relationship, backref



from scp.modelo.models import Base



class AsignacionRecurso(Base):
    """ Clase que utilizamos para gestionar el dinamismo de los roles para Proyectos y Fases """
    
    __tablename__ = 'asignacionRecurso'
    id = Column(Integer, primary_key=True)
    
    
    recurso_id = Column(Integer, ForeignKey('recurso.id', onupdate="CASCADE", ondelete="CASCADE"))
    recurso = relationship("Recurso", uselist=False)
    
    rol_id = Column(Integer, ForeignKey('rol.id'))
    rol = relationship("Rol", uselist=False)
    
    usuario_id = Column(Integer, ForeignKey('usuario.id'))
    usaurio = relationship("Usuario", uselist=False)
    
